package my.edu.common.utils;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import my.edu.common.domain.PageVO;

import java.util.List;

public class PageUtils {

    public static <T> PageVO<T> toPage(List<T> voList, long total) {
        return PageVO.<T>builder()
                .total(total)
                .data(voList).build();
    }

    public static <T> PageVO<T> toPage(IPage<T> roleVOPage) {
        return PageVO.<T>builder()
                .total(roleVOPage.getTotal())
                .data(roleVOPage.getRecords()).build();
    }
}
